import { Object3D } from 'three-legacy';
import { MeasureObject } from './renderObject';

export abstract class MeasureChildObject extends Object3D {
  rootObject: MeasureObject;

  getRootObject() {
    let currentParent = this.parent;

    while (currentParent != null) {
      if (currentParent instanceof MeasureObject) {
        this.rootObject = currentParent;
        return currentParent;
      }
      currentParent = currentParent.parent;
    }

    return null;
  }

  isHovered: boolean = false;
  isSelected: boolean = false;

  setHover(val: boolean) {
    this.isHovered = val;
    this.renderHighlight();
  }
  setSelect(val: boolean) {
    this.isSelected = val;
    this.renderHighlight();
  }

  renderHighlight() {}
}
